# OOP

# 类定义
class Person:
    def __int__(self):
        print("构造函数")
        pass

    def set_name(self, name):
        self.name = name

    def get_name(self):
        return self.name

    def greet(self):
        print(f'Hi! I am {self.name}')


# 使用类
xiaowang = Person()
xiaowang.set_name("xiaowang")
xiaowang.greet()  # Hi! I am xiaowang
print(xiaowang.get_name())

# 访问属性
print(xiaowang.name)
